home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / VISUALBA / VB_SMPL.ZIP / SEEKLST.EXE / SEEK_PUB.FRM < prev    next >
Text File  |  1994-04-26  |  11KB  |  402 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "Table Object of Publishers Name from List box to Seek"
  4.    ClientHeight    =   5865
  5.    ClientLeft      =   1110
  6.    ClientTop       =   1020
  7.    ClientWidth     =   6375
  8.    Height          =   6270
  9.    Left            =   1050
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   5865
  12.    ScaleWidth      =   6375
  13.    Top             =   675
  14.    Width           =   6495
  15.    Begin CommandButton Command4 
  16.       Caption         =   "Push to Not Save Changes"
  17.       Height          =   615
  18.       Left            =   120
  19.       TabIndex        =   21
  20.       Top             =   5040
  21.       Visible         =   0   'False
  22.       Width           =   2415
  23.    End
  24.    Begin CommandButton Command3 
  25.       Caption         =   "Push to Save Changes"
  26.       Height          =   615
  27.       Left            =   3840
  28.       TabIndex        =   11
  29.       Top             =   5040
  30.       Visible         =   0   'False
  31.       Width           =   2415
  32.    End
  33.    Begin TextBox Text8 
  34.       Height          =   375
  35.       Left            =   3840
  36.       TabIndex        =   2
  37.       Top             =   1320
  38.       Width           =   2295
  39.    End
  40.    Begin TextBox Text7 
  41.       Height          =   375
  42.       Left            =   4080
  43.       TabIndex        =   7
  44.       Top             =   2760
  45.       Width           =   2055
  46.    End
  47.    Begin TextBox Text6 
  48.       Height          =   375
  49.       Left            =   4920
  50.       TabIndex        =   5
  51.       Top             =   2040
  52.       Width           =   1215
  53.    End
  54.    Begin TextBox Text5 
  55.       Height          =   375
  56.       Left            =   3240
  57.       TabIndex        =   4
  58.       Top             =   2040
  59.       Width           =   975
  60.    End
  61.    Begin TextBox Text4 
  62.       Height          =   375
  63.       Left            =   720
  64.       TabIndex        =   3
  65.       Top             =   2040
  66.       Width           =   1575
  67.    End
  68.    Begin TextBox Text3 
  69.       Height          =   375
  70.       Left            =   1200
  71.       TabIndex        =   6
  72.       Top             =   2760
  73.       Width           =   1815
  74.    End
  75.    Begin TextBox Text2 
  76.       Height          =   375
  77.       Left            =   1920
  78.       TabIndex        =   8
  79.       Top             =   3480
  80.       Width           =   2295
  81.    End
  82.    Begin ListBox List1 
  83.       Height          =   615
  84.       Left            =   1800
  85.       Sorted          =   -1  'True
  86.       TabIndex        =   0
  87.       Top             =   480
  88.       Width           =   2775
  89.    End
  90.    Begin TextBox Text1 
  91.       Height          =   375
  92.       Left            =   2160
  93.       TabIndex        =   1
  94.       Top             =   1320
  95.       Width           =   735
  96.    End
  97.    Begin CommandButton Command2 
  98.       Caption         =   "Push to make Read/Write"
  99.       Height          =   495
  100.       Left            =   3840
  101.       TabIndex        =   10
  102.       Top             =   4200
  103.       Width           =   2415
  104.    End
  105.    Begin CommandButton Command1 
  106.       Caption         =   "Push to make ReadOnly"
  107.       Height          =   495
  108.       Left            =   120
  109.       TabIndex        =   9
  110.       Top             =   4200
  111.       Width           =   2415
  112.    End
  113.    Begin Label Label10 
  114.       Alignment       =   2  'Center
  115.       AutoSize        =   -1  'True
  116.       Caption         =   "Default is Read/Write"
  117.       FontBold        =   -1  'True
  118.       FontItalic      =   -1  'True
  119.       FontName        =   "MS Sans Serif"
  120.       FontSize        =   9.75
  121.       FontStrikethru  =   0   'False
  122.       FontUnderline   =   0   'False
  123.       Height          =   240
  124.       Left            =   1800
  125.       TabIndex        =   22
  126.       Top             =   0
  127.       Width           =   2355
  128.    End
  129.    Begin Label Label9 
  130.       Caption         =   "Address:"
  131.       Height          =   255
  132.       Left            =   3000
  133.       TabIndex        =   20
  134.       Top             =   1320
  135.       Width           =   735
  136.    End
  137.    Begin Label Label8 
  138.       Caption         =   "Fax:"
  139.       Height          =   255
  140.       Left            =   3480
  141.       TabIndex        =   19
  142.       Top             =   2760
  143.       Width           =   495
  144.    End
  145.    Begin Label Label7 
  146.       Caption         =   "Zip:"
  147.       Height          =   255
  148.       Left            =   4440
  149.       TabIndex        =   18
  150.       Top             =   2040
  151.       Width           =   375
  152.    End
  153.    Begin Label Label6 
  154.       Caption         =   "State:"
  155.       Height          =   255
  156.       Left            =   2520
  157.       TabIndex        =   17
  158.       Top             =   2040
  159.       Width           =   615
  160.    End
  161.    Begin Label Label5 
  162.       Caption         =   "City:"
  163.       Height          =   255
  164.       Left            =   120
  165.       TabIndex        =   16
  166.       Top             =   2040
  167.       Width           =   495
  168.    End
  169.    Begin Label Label4 
  170.       Caption         =   "Company Name:"
  171.       Height          =   255
  172.       Left            =   120
  173.       TabIndex        =   15
  174.       Top             =   3600
  175.       Width           =   1455
  176.    End
  177.    Begin Label Label3 
  178.       Caption         =   "Telephone:"
  179.       Height          =   255
  180.       Left            =   120
  181.       TabIndex        =   14
  182.       Top             =   2760
  183.       Width           =   975
  184.    End
  185.    Begin Label Label2 
  186.       Caption         =   "Select a Publisher's Name from the List ---->"
  187.       Height          =   735
  188.       Left            =   120
  189.       TabIndex        =   13
  190.       Top             =   360
  191.       Width           =   1575
  192.    End
  193.    Begin Label Label1 
  194.       Caption         =   "Publisher Identification:"
  195.       Height          =   255
  196.       Left            =   120
  197.       TabIndex        =   12
  198.       Top             =   1320
  199.       Width           =   2055
  200.    End
  201. End
  202. Option Explicit
  203. Dim readonly_flag%              '** readonly flag var
  204. Dim idx%                        '** index var for combo boxes
  205. Dim a%                          '** holds the Pubid num selected from list box
  206.  
  207. Dim db1 As database             '** database var
  208. Dim ds1 As dynaset              '** dynaset var
  209. Dim tbl1 As table               '** table var for seeking
  210.  
  211. Sub check_if_readonly (keyascii As Integer)
  212.  
  213.  If keyascii > 0 And readonly_flag% = 1 Then     '** if they press any key and readonly_flag% = 1 then
  214.   keyascii = 0                                   '** turn keystroke off
  215.  Else
  216.   command3.Visible = True
  217.   command4.Visible = True
  218.  End If
  219.  
  220. End Sub
  221.  
  222. Sub Command1_Click ()
  223.  
  224.  readonly_flag% = 1          '*** set readonly_flag% to 1 to makde text boxes readonly
  225.  label10.Caption = "ReadOnly record"
  226.  
  227. End Sub
  228.  
  229. Sub Command2_Click ()
  230.  
  231.  readonly_flag% = 0          '*** set readonly_flag% to 0 to make text boxes read/write
  232.  label10.Caption = "Read/Write record"
  233.  
  234. End Sub
  235.  
  236. Sub Command3_Click ()
  237.  
  238.  label10.Caption = "Changes made to the record, select another record"
  239.  
  240.  Call update_record
  241.  
  242. End Sub
  243.  
  244. Sub Command4_Click ()
  245.  
  246.  list1.SetFocus
  247.  label10.Caption = "No Changes made to the record, re-select same record"
  248.  
  249.  command3.Visible = False
  250.  command4.Visible = False
  251.  label2.Caption = "Select another Publisher's Name from the List ---->"
  252.  
  253. End Sub
  254.  
  255. Sub Form_Load ()
  256.  
  257.  readonly_flag% = 0        '** set default to read/write
  258.  
  259.  Set db1 = OpenDatabase("c:\vb\biblio.mdb", False, True)      '** may need to change path, opened for readonly for readonly list box(faster)
  260.  Set ds1 = db1.CreateDynaset("select name from publishers")   '** bring in all(*) record in the authors table
  261.  
  262.  Do While ds1.EOF = False
  263.   list1.AddItem " " & ds1("name")   '** add publisher names, if null add a space
  264.   ds1.MoveNext
  265.  Loop
  266.  
  267.  ds1.Close
  268.  db1.Close
  269.  
  270.  
  271. End Sub
  272.  
  273. Sub List1_Click ()
  274.  
  275. If readonly_flag% = 1 Then
  276.  label10.Caption = "ReadOnly record"
  277.  Set db1 = OpenDatabase("c:\vb\biblio.mdb", False, True)      '** may need to change path, opened for readonly for readonly list box(faster)
  278. Else
  279.  label10.Caption = "Read/Write record"
  280.  Set db1 = OpenDatabase("c:\vb\biblio.mdb")      '** may need to change path, opened for read/write
  281. End If
  282.  
  283.  a% = list1.ListI